<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
<script>
    var ctx = '${ctx}';
</script>
	<title>撤场单管理</title>
	<meta name="decorator" content="ani"/>
	<%@ include file="/webpage/include/bootstraptable.jsp"%>
	<%@include file="/webpage/include/treeview.jsp" %>
	<script src="${ctxStatic}/common/js/common.js"></script> 
	<!-- 引入 echarts.js -->
	<%@ include file="/webpage/include/echarts.jsp"%>
	<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-gl/echarts-gl.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/dataTool.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/china.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/world.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/bmap.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/simplex.js"></script>
	<script type="text/javascript">

		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					//jp.loading();
					//form.submit();
					$.ajax({
		                url:"${ctx}/sc/withdraw/withdraw/save",
		                type:"post",
		                data:$('#inputForm').serialize(),
		                beforeSend: function () {
		                    // 禁用按钮防止重复提交
		                    $("#submit").attr({ disabled: "disabled" });
		                },
		                success:function(data){
							if(data.code=='0'){
								jp.info(data.message);
								window.location.href="${ctx}/sc/withdraw/withdraw/list";
							}
							else{
								jp.warning(data.message);
							}
		                },
		                complete: function () {
		                    $("#submit").removeAttr("disabled");
		                },
		            });
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
	</script>
</head>
<body>
<div class="wrapper wrapper-content">				
<div class="row">
	<div class="col-md-12">
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title"> 
				<a class="panelButton" href="${ctx}/sc/withdraw/withdraw"><i class="ti-angle-left"></i> 返回</a>
			</h3>
		</div> 
		<div class="panel-body">
		<form:form id="inputForm" modelAttribute="withdraw" action="${ctx}/sc/withdraw/withdraw/save" method="post" class="form-horizontal">
		<div class="form-group">
			<input id="conn"  type="button" class="btn btn-primary" value="闸机扫描" />
			<input id="phoneConn"  type="button" class="btn btn-primary" value="手机扫描" />
		    <input id="close" type="button" class="btn btn-success" value="识别" />
		    <input id="clear" type="button" class="btn btn-danger" value="清空" />
		    <button id="submit" class="btn btn-info" data-loading-text="正在提交...">提 交</button>
		    <label id="isConnect" class="col-sm-2" style="display: none;">false</label>
		</div>  
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
				<div class="form-group">
					<label class="col-sm-2 control-label">仓库类型：</label>
					<div class="col-sm-4">
						<form:select path="warehouseType" class="form-control " cssClass="form-control required" onchange="findWarehouse('warehouseId','warehouseType')">
							
						</form:select>
					</div>
					<label class="col-sm-2 control-label">仓库名称：</label>
					<div class="col-sm-4">
						<form:select path="warehouseId" cssClass="form-control required" class="form-control ">
							
						</form:select>
					</div>
				</div>
							
				<div class="form-group">
					<label class="col-sm-2 control-label">撤场原因：</label>
					<div class="col-sm-4">
						<form:select path="withdrawReason" cssClass="form-control required" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('sc_withdraw_reason')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
					<label class="col-sm-2 control-label">备注：</label>
					<div class="col-sm-4">
						<form:input path="comment" htmlEscape="false"   class="form-control "/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">撤场项目：</label>
					<div class="col-sm-10">
						<form:input path="withdrawStockroomName" htmlEscape="false"  cssClass="form-control required"  class="form-control "/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">编码：</label>
					<div class="col-sm-10">
						<form:input path="resourceIds" htmlEscape="false"  cssClass="form-control required"  class="form-control "/>
					</div>
				</div>
		<div id="main" style="width: 100%;height:300px;display: none"></div>		
		<div id="resourceDiv">
			<table id="checkResourceTable"  data-toolbar="#toolbar" ></table>
		
		</div>
	
		
		</form:form>
		</div>				
	</div>
	</div>
</div>
</div>
<script type="text/javascript">
	findWarehouseType("warehouseType",[]);
</script>
</body>
</html>